/***
 *
 * desc：api urls in app
 *
 */
import config from "./config.js";
import md5 from "blueimp-md5";

const URL_ = {
    GET_CLASS: '/client-page-info/current.json',
    CURRENT: '/client-page-info/home.json',
    HOME: '/client-page-info/home.json',
    ACTIVITY: '/client-page-info/campaign.json',
    NEWS: '/client-page-info/news.json',
    ANNOUNCE: '/client-page-info/announce.json',
    CLASS: '/client-page-info/class.json',
    TODAY_TEACH: '/client-page-info/teaching-plan.json',
    DUTY: '/client-page-info/duty.json',
    HOMEWORK: 'client-page-info/homework.json',
    SCHEDULE: '/client-page-info/time-table.json',
    // CLASS: '/client-page-info/class.json?classid=ci00000000000002',
    //CAMPAIGN: '/client-page-info/campaign.json?classid=ci00000000000002'
    //分类
};
for (var url in URL_) {
    if ((URL_[url].indexOf('.json') == -1)) {
        URL_[url] = '/' + config.api_prefix + URL_[url] + '.json';
    } else {
        URL_[url] = '/' + config.api_prefix + URL_[url];
    }
}
var md5Url_ = {};
Object.keys(URL_).forEach((key)=> {
    var key_url = URL_[key];
    var key_md5 = key_url.slice(0, key_url.indexOf('.'));
    md5Url_[key] = md5(key_md5);
});
URL_.FUN_UPLOAD_PREVIEW = (imageid) => {
    return `/${config.api_prefix}/image/${imageid}`;
};
export var md5Url = md5Url_;
export var Url = URL_;

